jq(function(){
	ccc();
	function ccc(){
		var id1=jq("#selList1").val();
		var $selList2=jq("#selList2").empty();
		jq.getJSON("ProductUpdateServlet1","id1="+id1,xxxxx);
		function xxxxx(data){
			for(var i=0;i<data.length;i++){
				$selList2.append("<option value=\""+data[i].id+"\" <c:if test=\""+data[i].id+"==${idl2}\"> <c:out value=\"selected\" /  >"+data[i].name+"</option>");
				
			}
			ddd();	
			function ddd(){
				var id2=jq("#selList2").val();
				var $selList3=jq("#selList3").empty();
				jq.getJSON("ProductUpdateServlet1","id1="+id2,zzzz);
				function zzzz(data1){
					for(var j=0;j<data1.length;j++){
						
						$selList3.append("<option value=\""+data1[j].id+"\" <c:if test=\""+data1[j].id+"==${idl3}\"> <c:out value=\"selected\" /  >"+data1[j].name+"</option>");
					}
				}
				
			}
		}
	}
	
	jq("#selList1").change(function(){
		ccc();
		ddd();
	});
	
	
	jq("#sureUpdate").click(function(){
		var url=window.location.search;
		var id=url.substring(url.indexOf("=")+1);
		var level1id=jq("#selList1").val();
		var level2id=jq("#selList2").val();
		var level3id=jq("#selList3").val();
		var name=jq("#name").val();
		var price=jq("#price").val();
		var stock=jq("#stock").val();
		var description=jq("#description").val();
		jq.get("ProductSaveServlet","id="+id+"&level1id="+level1id+"&level2id="+level2id+"&level3id="+level3id+"&name="+name+"&price="+price+"&stock="+stock+"&description="+description,save,"text");
		function save(data){
			if(data=="success"){
				location.href="Member_ProductBiz.html";
			}
			
		}
		
		
	});
	
	
	
});